Cacti : Install
2016/06/08 |
Install Cacti to monitor system status.
|
|
[1] | |
[2] | |
[3] | |
[4] | Install Cacti, SNMP. |
root@dlp:~#
apt-get -y install cacti snmp snmpd snmp-mibs-downloader php-mysql php-snmp rrdtool # select apache2 on here +-------------------------+ Configuring cacti +--------------------------+ | Please select the web server for which Cacti should be automatically | | configured. | | | | Select "None" if you would like to configure the web server manually. | | | | Web server: | | | | apache2 | | lighttpd | | None | | | | | | <Ok> | | | +------------------------------------------------------------------------+ # select No on here +---------------------------+ Configuring cacti +---------------------------+ | | | The cacti package must have a database installed and configured before | | it can be used. This can be optionally handled with dbconfig-common. | | | | If you are an advanced database administrator and know that you want to | | perform this configuration manually, or if your database has already | | been installed and configured, you should refuse this option. Details | | on what needs to be done should most likely be provided in | | /usr/share/doc/cacti. | | | | Otherwise, you should probably choose this option. | | | | Configure database for cacti with dbconfig-common? | | | | <Yes> <No> | | | +---------------------------------------------------------------------------+ |
[5] | Configure SNMP (Simple Network Management Protocol). |
root@dlp:~#
vi /etc/snmp/snmp.conf # line 4: comment out # mibs :
root@dlp:~#
vi /etc/snmp/snmpd.conf # line 49: uncomment and change to any comunity name you like rocommunity Serverworld localhost
# line 51: comment out # rocommunity public default -V systemonly
root@dlp:~#
systemctl restart snmpd # validation (replace "Serverworld" to the comunity name you set) root@dlp:~# snmpwalk -v 2c -c Serverworld localhost system SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.srv.world 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1732) 0:00:17.32 ..... ..... SNMPv2-MIB::sysORUpTime.9 = Timeticks: (1) 0:00:00.01 SNMPv2-MIB::sysORUpTime.10 = Timeticks: (1) 0:00:00.01 |
[6] | Create a Database for Cacti and import tables. |
root@dlp:~# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 32 Server version: 10.0.24-MariaDB-7 Ubuntu 16.04 Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # create a "Cacti" database ( set any password for 'password' section )
MariaDB [(none)]>
create database cacti; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on cacti.* to cacti@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
flush privileges; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
root@dlp:~# exit Bye mysql -u cacti -p cacti < /usr/share/doc/cacti/cacti.sql Enter password: # cacti user's password
|
[7] | Configure Cacti. |
root@dlp:~#
vi /usr/share/cacti/site/include/config.php # line 42: change Cacti's DB connection info $database_type = "mysqli"; $database_default = " cacti ";$database_hostname = "localhost"; $database_username = " cacti ";$database_password = " password ";$database_port = " 3306 ";$database_ssl = false;
root@dlp:~#
vi /etc/apache2/conf-available/cacti.conf # line 7: change access permission # Require all granted
Require host localhost
Require ip 10.0.0.0/24 systemctl restart apache2 |